package cn.com.pansky.service;

import java.util.UUID;

import net.vsame.url2sql.helper.SqlHelper;
import cn.com.pansky.util.DateUtil;

import com.alibaba.fastjson.JSONObject;

public class NoticeService {

	public void add(JSONObject json, String userid) {
		String aae036 = DateUtil.current19Time();
		
		String insertIC51  = "insert into ic51 (ID, TYPE, MSG, DATA, AAE036, CATEGORY) values (?, ?, ?, ?, ?, ?)";
		String insertIC52 = "insert into ic52 (ID, NOTICEID, USERID, ISREAD, REMOVED, READTIME, REMOVEDTIME, RESULT)"
				+ "values (?, ?, ?, 'N', 'N', null, null, null)";
		String ic51 = UUID.randomUUID().toString();
		String ic52 = UUID.randomUUID().toString();
		SqlHelper.execute(insertIC51, ic51, json.get("s"), json.get("t"), json.get("m"), aae036, json.get("c"));
		if(!"".equals(userid)) {
			
			SqlHelper.execute(insertIC52, ic52, ic51, userid, aae036);
		}
	}
	
	public static void main(String[] args) {
		NoticeService ns = new NoticeService();
		JSONObject pushData = new JSONObject();
		pushData.put("s", "1");//业务办理类型
		pushData.put("t", "测试");//业务办理类型
		pushData.put("m", "缴费通知");//通知头
		pushData.put("d", "缴费成功");//通知内容
		pushData.put("c", "1");//通知内容
		ns.add(pushData, "1111");
	}
}
